<!DOCTYPE html>
<html>
    <head>
          <meta charset="UTF-8">
            <title>查火车票</title>
            </head>
            <body>
                  <h1>查火车票</h1>
                    出发地：<input id="from" placeholder="北京"><br>
                      目的地：<input id="to" placeholder="上海"><br>
                        日期：<input type="date" id="date" value="2025-09-10"><br>
                          <button onclick="search()">查询</button>
                            <div id="result" style="margin-top:20px;"></div>
                              <script>
                                      function search() {
                                            const f = document.getElementById('from').value;
                                                  const t = document.getElementById('to').value;
                                                        const box = document.getElementById('result');
                                                              const trains = [
                                                                      {trainNo:'G1',from:f,to:t,depTime:'06:00',arrTime:'10:28',price:'¥553'},
                                                                              {trainNo:'G3',from:f,to:t,depTime:'07:00',arrTime:'11:28',price:'¥553'}
                                                                                    ];
                                                                                          box.innerHTML = '<h3>演示车次</h3>' + trains.map(g=>`
                                                                                                  <div style="border:1px solid #ccc;padding:8px;margin:6px 0;">
                                                                                                            <b>${g.trainNo}</b>　${g.from} → ${g.to}<br>
                                                                                                                      时间：${g.depTime} - ${g.arrTime}　二等座：${g.price}
                                                                                                                              </div>`).join('');
                                                                                                                                  }
                                                                                                                                    </script>
                                                                                                                                    </body>
                                                                                                                                    </html>
                                                                                                                                    